public class 宝石与石头 {
    //https://leetcode.cn/problems/jewels-and-stones/
    //哈希表的简单运用
    public int numJewelsInStones(String jewels, String stones) {
        int[] hash = new int[256];
        for(int i = 0;i < jewels.length();i++){
            hash[jewels.charAt(i)]++;
        }
        int ans = 0;
        for(int i = 0;i < stones.length();i++){
            if(hash[stones.charAt(i)] > 0){
                ans++;
            }
        }
        return ans;
    }
}
